import json

from ronglian_sms_sdk import SmsSDK



def sendMsg(mobile, code):
    accId = '8aaf070882ede8b301835460bee811df'
    accToken = 'edc94e3a8fbe4a989cc5789c97f6bc25'
    appId = '8aaf070882ede8b301835460bfd511e6'
    sdk = SmsSDK(accId, accToken, appId)
    # 发送短信的模板
    tid = '1'
    # 是一个元组类型的
    datas = (code, 5)
    # 4. 连接redis存入， 登录时需要校验所以需要保存
    resp = sdk.sendMessage(tid, mobile, datas)
    mes = json.loads(resp)
    print('smg================================', mes)
    if mes['statusCode'] == '000000' or mes['statusCode'] == '112310':
        print(resp)
        return True
    return False